﻿$(function(){
     if($('.hot_project').is(':visible')) {
    	TouchSlide({slideCell: "#hot_project",titCell: ".hd ul",autoPage: true,autoPlay: false,effect: "leftLoop"});
    	var mySwiper = new Swiper('.case_slider',{freeMode : true, slidesPerView: 2.5, freeModeMomentum : true });
    	$(".case_slider .swiper-wrapper").append("<div class='swiper-slide'></div>");
    }

    /*飞机*/
     if($('.plane').is(':visible')) {
        setTimeout(function(){
            $(".plane span").animate({'right':75+'%'},2000,function(){
                $(this).animate({'top':1.7+'rem'},1500,function(){
                    $(this).animate({'right':0+'%'},2500,function(){
                        $(this).animate({'top':0.22+'rem'},1500);
                    });
                });
            });
        },3000);
    }

    if($('.reality_nav').is(':visible')) {
    var galleryThumbs = new Swiper('.reality_nav', {freeMode : true, slidesPerView: 4, freeModeMomentum : true});
    }
     if($('.introduce_slider').is(':visible')) {
        var galleryThumbs = new Swiper('.introduce_slider', {freeMode : true, slidesPerView: 2.5, freeModeMomentum : true});
        $(".introduce_slider .swiper-wrapper").append("<div class='swiper-slide'></div>");
    }

    /*案例轮播*/
     var swiper = new Swiper('.case_box', {
            pagination: '.swiper-pagination',
            paginationClickable: true,
            autoHeight: true,
            observer:true,
            observeParents:true,
            onSlideChangeEnd: function(swiper){
                swiper.update();
            }
     });
    /*案例点击切换*/
    $(".reality_content .case_box:gt(0)").hide();
    $("#reality .reality_nav ul li").click(function(){
        var i = $(this).index();
        $(this).addClass('on').siblings().removeClass('on');
        $(".reality_content .case_box").eq(i).show().siblings().hide();
    }); 
    /*学术会议点击切换*/
    $(".introduce_content .introduce_slider:eq(0)").show().siblings().hide();
    $(".introduce_nav li:eq(0)").addClass('on');
    $(".introduce_nav li").click(function(){
        var i = $(this).index();
        $(this).addClass('on').siblings().removeClass('on');
        $(".introduce_content .introduce_slider").eq(i).show().siblings().hide();
    });

    set = setInterval('fz()',3000);
    $(".news_nav li").hover(function(){
        $('.news_nav li').removeClass('on');
        $(this).addClass("on");
        set = clearTimeout(set);
    },function(){
        set = setInterval('fz()',3000);
    });
    /*测试首页咨询标识*/
    $('[href="javascript:openK();"]').attr('href','javascript:void(0);').attr('onclick','openK(this);return false;');
});



    /*首页项目随机翻转*/
    var lh = 0;
    function fz(){
            var leng = $(".project_hot a").length;
                $('.news_nav li').removeClass('on');
                $('.news_nav li').eq(lh).addClass("on");
                lh++;
                if(lh==6)lh=0;
    }

    window.onload = setInterval(function(){
        var leng = $(".project_hot a").length;
            var ran = parseInt(Math.random()*leng);
            var arr = [ran,ran-'1'];
                $('.project_hot a').removeClass('on');
                $('.project_hot a').eq(arr[0]).addClass("on");
        },3000);